import React from 'react';
import logo from './logo.svg';
import './App.css';
import axios from "axios"


class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }

  componentWillMount() {
    this.getList()
  }



  getList = async () => {
    let data = await axios.get("http://localhost:8888/ceshi")
    // console.log(data.data.data)
    this.setState({
      list: data.data.data
    })
  }

  render() {
    return (
      <div>
        {
          this.state.list.map((item) => {
            return (
              <div key={item.id}>
                {item.name}----{item.age}
              </div>
            )
          })
        }
      </div>
    )
  }
}

export default App;